package org.grow.enter.config;

import org.grow.enter.filter.First;
import org.grow.enter.filter.Fourth;
import org.grow.enter.filter.Second;
import org.grow.enter.filter.Third;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Random;

/**
 * @Author: xwg
 * @CreateDate: 2021/9/8
 */

@Configuration
public class CommonConfig {

    @Autowired
    private First first;
    @Bean
    public FilterRegistrationBean<First> firstFilter(){
        FilterRegistrationBean<First> bean = new FilterRegistrationBean<>();
        bean.setFilter(first);
        bean.setOrder(100);
        return bean;
    }
    @Autowired
    private Second second;
    @Bean
    public FilterRegistrationBean<Second> secondFilter(){
        FilterRegistrationBean<Second> bean = new FilterRegistrationBean<>();
        bean.setFilter(second);
        bean.setOrder(200);
        return bean;
    }
    @Autowired
    private Third third;
    @Bean
    public FilterRegistrationBean<Third> thirdFilter(){
        FilterRegistrationBean<Third> bean = new FilterRegistrationBean<>();
        bean.setFilter(third);
        bean.setOrder(300);
        return bean;
    }
    @Bean
    public FilterRegistrationBean<Fourth> fourthFilter(Fourth fourth){
        FilterRegistrationBean<Fourth> bean = new FilterRegistrationBean<>();
        bean.setFilter(fourth);
        bean.setOrder(400);
        return bean;
    }
}
